package cn.bdqn.pn.reposity.commodity;

import cn.bdqn.pn.pojo.commodity.Showtype;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ShowTypeMapper extends JpaRepository<Showtype,Integer>,JpaSpecificationExecutor<Showtype> {
    @Query(value = "select * from ShowType where fatherId>0 order by ?#{#pageable}"
            ,countQuery = "select count(*) from ShowType where fatherId>0"
            ,nativeQuery = true)
    Page<Showtype> listAllShowtype(Pageable pageable);

    public List<Showtype> findShowtypesByFatherId(Integer fatherId);
    public List<Showtype> findByTypeName(String typeName);
    Showtype findShowtypeByShowTypeId(Integer showTypeId);
}
